.*?@si', '', $truncate); $truncate = preg_replace('@]*?>.*?@si', '', $truncate); $truncate = strip_tags($truncate); $truncate = substr($truncate, 0, strrpos(substr($truncate, 0, $amount), ' ')); echo $truncate; echo " ... "; if ($quote_after) echo(''); } // ------------------------------------------------ // ---- Add rel attributes to embedded images ---- // ------------------------------------------------ function insert_rel_anthemes($content) { $pattern = '//i'; $replacement = ''; $content = preg_replace( $pattern, $replacement, $content ); return $content; } add_filter( 'the_content', 'insert_rel_anthemes' ); // ---- Add rel attributes to gallery images ---- add_filter('wp_get_attachment_link', 'add_gallery_id_rel_anthemes'); function add_gallery_id_rel_anthemes($link) { global $post; return str_replace(' 'standard', 'title' => __( 'Format Video Youtube', 'rwmb' ), 'context' => 'normal', 'priority' => 'high', 'autosave' => true, // List of meta fields 'fields' => array( // TEXT array( // Field name - Will be used as label 'name' => __( 'Youtube', 'rwmb' ), // Field ID, i.e. the meta key 'id' => "{$prefix}youtube", // Field description (optional) 'desc' => __( 'Add Youtube code ex: HIrMIeN5ttE', 'rwmb' ), 'type' => 'text', // Default value (optional) 'std' => __( '', 'rwmb' ), // CLONES: Add to make the field cloneable (i.e. have multiple value) 'clone' => false, ), ), ); // 2nd meta box $meta_boxes[] = array( 'title' => __( 'Format Video Vimeo', 'rwmb' ), // List of meta fields 'fields' => array( // TEXT array( // Field name - Will be used as label 'name' => __( 'Vimeo', 'rwmb' ), // Field ID, i.e. the meta key 'id' => "{$prefix}vimeo", // Field description (optional) 'desc' => __( 'Add Vimeo code ex: 7449107', 'rwmb' ), 'type' => 'text', // Default value (optional) 'std' => __( '', 'rwmb' ), // CLONES: Add to make the field cloneable (i.e. have multiple value) 'clone' => false, ), ), ); // 3rd meta box $meta_boxes[] = array( 'title' => __( 'Format Slider Gallery', 'rwmb' ), // List of meta fields 'fields' => array( // IMAGE UPLOAD array( 'name' => __( 'Image with any size!', 'rwmb' ), 'id' => "{$prefix}slider", 'type' => 'image_advanced', ), ), ); // 4th meta box $meta_boxes[] = array( 'title' => __( 'Hide Featured Image', 'rwmb' ), // List of meta fields 'fields' => array( array( 'name' => __( 'Hide Featured Image', 'rwmb' ), 'id' => "{$prefix}hideimg", 'desc' => __( 'Hide Featured Image on single page for this article', 'rwmb' ), 'type' => 'checkbox', ), ), ); /** * Register meta boxes * * @return void */ function anthemes_register_meta_boxes() { // Make sure there's no errors when the plugin is deactivated or during upgrade if ( !class_exists( 'RW_Meta_Box' ) ) return; global $meta_boxes; foreach ( $meta_boxes as $meta_box ) { new RW_Meta_Box( $meta_box ); } } // Hook to 'admin_init' to make sure the meta box class is loaded before // (in case using the meta box class in another plugin) // This is also helpful for some conditionals like checking page template, categories, etc. add_action( 'admin_init', 'anthemes_register_meta_boxes' ); // ------------------------------------------------ // ---------- TGM_Plugin_Activation ------------- // ------------------------------------------------ require_once dirname( __FILE__ ) . '/functions/custom/class-tgm-plugin-activation.php'; add_action( 'tgmpa_register', 'my_theme_register_required_plugins' ); function my_theme_register_required_plugins() { $plugins = array( array( 'name' => 'Meta Box', // The plugin name 'slug' => 'meta-box', // The plugin slug (typically the folder name) 'source' => get_stylesheet_directory() . '/plugins/meta-box.zip', // The plugin source 'required' => true, // If false, the plugin is only 'recommended' instead of required 'version' => '1.2', // E.g. 1.0.0. If set, the active plugin must be this version or higher, otherwise a notice is presented 'force_activation' => false, // If true, plugin is activated upon theme activation and cannot be deactivated until theme switch 'force_deactivation' => false, // If true, plugin is deactivated upon theme switch, useful for theme-specific plugins 'external_url' => '', // If set, overrides default API URL and points to an external URL ), array( 'name' => 'Boutique Shortcodes', // The plugin name 'slug' => 'anthemes-shortcodes', // The plugin slug (typically the folder name) 'source' => get_stylesheet_directory() . '/plugins/anthemes-shortcodes.zip', // The plugin source 'required' => false, // If false, the plugin is only 'recommended' instead of required 'version' => '1.1', // E.g. 1.0.0. If set, the active plugin must be this version or higher, otherwise a notice is presented 'force_activation' => false, // If true, plugin is activated upon theme activation and cannot be deactivated until theme switch 'force_deactivation' => false, // If true, plugin is deactivated upon theme switch, useful for theme-specific plugins 'external_url' => '', // If set, overrides default API URL and points to an external URL ), array( 'name' => 'Boutique Reviews', // The plugin name 'slug' => 'boutique-reviews', // The plugin slug (typically the folder name) 'source' => get_stylesheet_directory() . '/plugins/boutique-reviews.zip', // The plugin source 'required' => false, // If false, the plugin is only 'recommended' instead of required 'version' => '', // E.g. 1.0.0. If set, the active plugin must be this version or higher, otherwise a notice is presented 'force_activation' => false, // If true, plugin is activated upon theme activation and cannot be deactivated until theme switch 'force_deactivation' => false, // If true, plugin is deactivated upon theme switch, useful for theme-specific plugins 'external_url' => '', // If set, overrides default API URL and points to an external URL ), array( 'name' => 'Boutique Likes', // The plugin name 'slug' => 'zilla-likes', // The plugin slug (typically the folder name) 'source' => get_stylesheet_directory() . '/plugins/zilla-likes.zip', // The plugin source 'required' => false, // If false, the plugin is only 'recommended' instead of required 'version' => '', // E.g. 1.0.0. If set, the active plugin must be this version or higher, otherwise a notice is presented 'force_activation' => false, // If true, plugin is activated upon theme activation and cannot be deactivated until theme switch 'force_deactivation' => false, // If true, plugin is deactivated upon theme switch, useful for theme-specific plugins 'external_url' => '', // If set, overrides default API URL and points to an external URL ), array( 'name' => 'Custom Sidebars', 'slug' => 'custom-sidebars', 'required' => false, 'version' => '', ), array( 'name' => 'Daves WordPress Live Search', 'slug' => 'daves-wordpress-live-search', 'required' => false, 'version' => '', ), array( 'name' => 'Multi-column Tag Map', 'slug' => 'multi-column-tag-map', 'required' => false, 'version' => '', ), ); // Change this to your theme text domain, used for internationalising strings $theme_text_domain = 'tgmpa'; $config = array( 'domain' => $theme_text_domain, // Text domain - likely want to be the same as your theme. 'default_path' => '', // Default absolute path to pre-packaged plugins 'parent_menu_slug' => 'themes.php', // Default parent menu slug 'parent_url_slug' => 'themes.php', // Default parent URL slug 'menu' => 'install-required-plugins', // Menu slug 'has_notices' => true, // Show admin notices or not 'is_automatic' => false, // Automatically activate plugins after installation or not 'message' => '', // Message to output right before the plugins table 'strings' => array( 'page_title' => __( 'Install Required Plugins', $theme_text_domain ), 'menu_title' => __( 'Install Plugins', $theme_text_domain ), 'installing' => __( 'Installing Plugin: %s', $theme_text_domain ), // %1$s = plugin name 'oops' => __( 'Something went wrong with the plugin API.', $theme_text_domain ), 'notice_can_install_required' => _n_noop( 'This theme requires the following plugin: %1$s.', 'This theme requires the following plugins: %1$s.' ), // %1$s = plugin name(s) 'notice_can_install_recommended' => _n_noop( 'This theme recommends the following plugin: %1$s.', 'This theme recommends the following plugins: %1$s.' ), // %1$s = plugin name(s) 'notice_cannot_install' => _n_noop( 'Sorry, but you do not have the correct permissions to install the %s plugin. Contact the administrator of this site for help on getting the plugin installed.', 'Sorry, but you do not have the correct permissions to install the %s plugins. Contact the administrator of this site for help on getting the plugins installed.' ), // %1$s = plugin name(s) 'notice_can_activate_required' => _n_noop( 'The following required plugin is currently inactive: %1$s.', 'The following required plugins are currently inactive: %1$s.' ), // %1$s = plugin name(s) 'notice_can_activate_recommended' => _n_noop( 'The following recommended plugin is currently inactive: %1$s.', 'The following recommended plugins are currently inactive: %1$s.' ), // %1$s = plugin name(s) 'notice_cannot_activate' => _n_noop( 'Sorry, but you do not have the correct permissions to activate the %s plugin. Contact the administrator of this site for help on getting the plugin activated.', 'Sorry, but you do not have the correct permissions to activate the %s plugins. Contact the administrator of this site for help on getting the plugins activated.' ), // %1$s = plugin name(s) 'notice_ask_to_update' => _n_noop( 'The following plugin needs to be updated to its latest version to ensure maximum compatibility with this theme: %1$s.', 'The following plugins need to be updated to their latest version to ensure maximum compatibility with this theme: %1$s.' ), // %1$s = plugin name(s) 'notice_cannot_update' => _n_noop( 'Sorry, but you do not have the correct permissions to update the %s plugin. Contact the administrator of this site for help on getting the plugin updated.', 'Sorry, but you do not have the correct permissions to update the %s plugins. Contact the administrator of this site for help on getting the plugins updated.' ), // %1$s = plugin name(s) 'install_link' => _n_noop( 'Begin installing plugin', 'Begin installing plugins' ), 'activate_link' => _n_noop( 'Activate installed plugin', 'Activate installed plugins' ), 'return' => __( 'Return to Required Plugins Installer', $theme_text_domain ), 'plugin_activated' => __( 'Plugin activated successfully.', $theme_text_domain ), 'complete' => __( 'All plugins installed and activated successfully. %s', $theme_text_domain ), // %1$s = dashboard link 'nag_type' => 'updated' // Determines admin notice type - can only be 'updated' or 'error' ) ); tgmpa( $plugins, $config ); } /** * Search SQL filter for matching against post title only. * * @link http://wordpress.stackexchange.com/a/11826/1685 * * @param string $search * @param WP_Query $wp_query */ function wpse_11826_search_by_title( $search, $wp_query ) { if ( ! empty( $search ) && ! empty( $wp_query->query_vars['search_terms'] ) ) { global $wpdb; $q = $wp_query->query_vars; $n = ! empty( $q['exact'] ) ? '' : '%'; $search = array(); foreach ( ( array ) $q['search_terms'] as $term ) $search[] = $wpdb->prepare( "$wpdb->posts.post_title LIKE %s", $n . $wpdb->esc_like( $term ) . $n ); if ( ! is_user_logged_in() ) $search[] = "$wpdb->posts.post_password = ''"; $search = ' AND ' . implode( ' AND ', $search ); } return $search; } add_filter( 'posts_search', 'wpse_11826_search_by_title', 10, 2 ); add_action('pre_get_posts','alter_query'); function alter_query($query){ if ($query->is_main_query() && is_home()) $query->set('orderby', 'date'); //Set the order to random } function remove_page_from_query_string($query_string) { if ($query_string['name'] == 'page' && isset($query_string['page'])) { unset($query_string['name']); $query_string['paged'] = $query_string['page']; } return $query_string; } add_filter('request', 'remove_page_from_query_string'); function custom_posts_per_page($query) { if (is_home()) { $query->set('posts_per_page', 24); } if (is_search()) { $query->set('posts_per_page', 20); } if (is_archive()) { $query->set('posts_per_page', 20); } //endif } //function //this adds the function above to the 'pre_get_posts' action add_action('pre_get_posts', 'custom_posts_per_page'); function wpse_category_single_template( $single_template ) { global $post; $all_cats = get_the_category(); if ( $all_cats[0]->cat_ID == '398' ) { if ( file_exists(get_template_directory() . "/hardreset.php") ) return get_template_directory() . "/hardreset.php"; } if ( $all_cats[0]->cat_ID == '399' ) { if ( file_exists(get_template_directory() . "/hardresetlg.php") ) return get_template_directory() . "/hardresetlg.php"; } if ( $all_cats[0]->cat_ID == '400' ) { if ( file_exists(get_template_directory() . "/hardresetmotorola.php") ) return get_template_directory() . "/hardresetmotorola.php"; } if ( $all_cats[0]->cat_ID == '403' ) { if ( file_exists(get_template_directory() . "/hardresetnokia.php") ) return get_template_directory() . "/hardresetnokia.php"; } if ( $all_cats[0]->cat_ID == '404' ) { if ( file_exists(get_template_directory() . "/hardresetxiaomi.php") ) return get_template_directory() . "/hardresetxiaomi.php"; } if ( $all_cats[0]->cat_ID == '405' ) { if ( file_exists(get_template_directory() . "/hardresetgoogle.php") ) return get_template_directory() . "/hardresetgoogle.php"; } if ( $all_cats[0]->cat_ID == '466' ) { if ( file_exists(get_template_directory() . "/hardresetsony.php") ) return get_template_directory() . "/hardresetsony.php"; } if ( $all_cats[0]->cat_ID == '406' ) { if ( file_exists(get_template_directory() . "/hardresetoneplus.php") ) return get_template_directory() . "/hardresetoneplus.php"; } if ( $all_cats[0]->cat_ID == '480' ) { if ( file_exists(get_template_directory() . "/hardresetoppo.php") ) return get_template_directory() . "/hardresetoppo.php"; } if ( $all_cats[0]->cat_ID == '407' ) { if ( file_exists(get_template_directory() . "/unlocksamsungpassword") ) return get_template_directory() . "/unlocksamsungpassword.php"; } if ( $all_cats[0]->cat_ID == '408' ) { if ( file_exists(get_template_directory() . "/frpbypasssamsung.php") ) return get_template_directory() . "/frpbypasssamsung.php"; } if ( $all_cats[0]->cat_ID == '409' ) { if ( file_exists(get_template_directory() . "/frpbypasslg.php") ) return get_template_directory() . "/frpbypasslg.php"; } if ( $all_cats[0]->cat_ID == '465' ) { if ( file_exists(get_template_directory() . "/frpbypassmotorola.php") ) return get_template_directory() . "/frpbypassmotorola.php"; } if ( $all_cats[0]->cat_ID == '472' ) { if ( file_exists(get_template_directory() . "/frpbypassoppo.php") ) return get_template_directory() . "/frpbypassoppo.php"; } if ( $all_cats[0]->cat_ID == '410' ) { if ( file_exists(get_template_directory() . "/unlockpasswordsamsung.php") ) return get_template_directory() . "/unlockpasswordsamsung.php"; } if ( $all_cats[0]->cat_ID == '412' ) { if ( file_exists(get_template_directory() . "/unlockpasswordnokia.php") ) return get_template_directory() . "/unlockpasswordnokia.php"; } if ( $all_cats[0]->cat_ID == '413' ) { if ( file_exists(get_template_directory() . "/unlockpasswordmotorola.php") ) return get_template_directory() . "/unlockpasswordmotorola.php"; } if ( $all_cats[0]->cat_ID == '414' ) { if ( file_exists(get_template_directory() . "/unlockpasswordlg.php") ) return get_template_directory() . "/unlockpasswordlg.php"; } if ( $all_cats[0]->cat_ID == '415' ) { if ( file_exists(get_template_directory() . "/unlockpasswordoneplus.php") ) return get_template_directory() . "/unlockpasswordoneplus.php"; } if ( $all_cats[0]->cat_ID == '468' ) { if ( file_exists(get_template_directory() . "/unlockpasswordzte.php") ) return get_template_directory() . "/unlockpasswordzte.php"; } if ( $all_cats[0]->cat_ID == '420' ) { if ( file_exists(get_template_directory() . "/unlockpasswordxiaomi.php") ) return get_template_directory() . "/unlockpasswordxiaomi.php"; } if ( $all_cats[0]->cat_ID == '464' ) { if ( file_exists(get_template_directory() . "/unlockpasswordoppo.php") ) return get_template_directory() . "/unlockpasswordoppo.php"; } if ( $all_cats[0]->cat_ID == '470' ) { if ( file_exists(get_template_directory() . "/unlockpasswordgoogle.php") ) return get_template_directory() . "/unlockpasswordgoogle.php"; } if ( $all_cats[0]->cat_ID == '476' ) { if ( file_exists(get_template_directory() . "/unlockpasswordhuawei.php") ) return get_template_directory() . "/unlockpasswordhuawei.php"; } if ( $all_cats[0]->cat_ID == '477' ) { if ( file_exists(get_template_directory() . "/unlockpasswordhonor.php") ) return get_template_directory() . "/unlockpasswordhonor.php"; } if ( $all_cats[0]->cat_ID == '478' ) { if ( file_exists(get_template_directory() . "/unlockpasswordvivo.php") ) return get_template_directory() . "/unlockpasswordvivo.php"; } if ( $all_cats[0]->cat_ID == '479' ) { if ( file_exists(get_template_directory() . "/unlockpasswordrealme.php") ) return get_template_directory() . "/unlockpasswordrealme.php"; } if ( $all_cats[0]->cat_ID == '416' ) { if ( file_exists(get_template_directory() . "/frpbypassnokia.php") ) return get_template_directory() . "/frpbypassnokia.php"; } if ( $all_cats[0]->cat_ID == '469' ) { if ( file_exists(get_template_directory() . "/frpbypassgoogle.php") ) return get_template_directory() . "/frpbypassgoogle.php"; } if ( $all_cats[0]->cat_ID == '471' ) { if ( file_exists(get_template_directory() . "/frpbypassoneplus.php") ) return get_template_directory() . "/frpbypassoneplus.php"; } if ( $all_cats[0]->cat_ID == '467' ) { if ( file_exists(get_template_directory() . "/frpbypassxiaomi.php") ) return get_template_directory() . "/frpbypassxiaomi.php"; } if ( $all_cats[0]->cat_ID == '475' ) { if ( file_exists(get_template_directory() . "/frpbypasssony.php") ) return get_template_directory() . "/frpbypasssony.php"; } if ( $all_cats[0]->cat_ID == '482' ) { if ( file_exists(get_template_directory() . "/frpbypasshonor.php") ) return get_template_directory() . "/frpbypasshonor.php"; } elseif ( $all_cats[0]->cat_ID == '111111' ) { if ( file_exists(get_template_directory() . "/1.php") ) return get_template_directory() . "/1.php"; } return $single_template; } add_filter( 'single_template', 'wpse_category_single_template' ); function guides_postsbycategory() { // the query $the_query = new WP_Query( array( 'category_name' => 'guides', 'posts_per_page' => 8 ) ); // The Loop if ( $the_query->have_posts() ) { $string .= ''; return $string; /* Restore original Post Data */ wp_reset_postdata(); } // Add a shortcode add_shortcode('guidesposts', 'guides_postsbycategory'); function reviews_postsbycategory() { // the query $the_query = new WP_Query( array( 'category_name' => 'reviews', 'posts_per_page' => 8 ) ); // The Loop if ( $the_query->have_posts() ) { $string .= ''; return $string; /* Restore original Post Data */ wp_reset_postdata(); } // Add a shortcode add_shortcode('reviewsposts', 'reviews_postsbycategory'); function hardreset_postsbycategory() { // the query $the_query = new WP_Query( array( 'category_name' => 'hard reset, hard reset google, hard reset nokia, hard reset lg, hard reset motorola, hard reset samsung, hard reset oneplus, hard reset xiaomi, hard reset sony', 'posts_per_page' => 8 ) ); // The Loop if ( $the_query->have_posts() ) { $string .= ''; return $string; /* Restore original Post Data */ wp_reset_postdata(); } // Add a shortcode add_shortcode('hardresetposts', 'hardreset_postsbycategory'); function frp_postsbycategory() { // the query $the_query = new WP_Query( array( 'category_name' => 'frp bypass, frp bypass lg, frp bypass xiaomi, frp bypass nokia, FRP Bypass Samsung, frp bypass motorola', 'posts_per_page' => 8 ) ); // The Loop if ( $the_query->have_posts() ) { $string .= ''; return $string; /* Restore original Post Data */ wp_reset_postdata(); } // Add a shortcode add_shortcode('frpposts', 'frp_postsbycategory'); function news_postsbycategory() { // the query $the_query = new WP_Query( array( 'category_name' => 'news', 'posts_per_page' => 8 ) ); // The Loop if ( $the_query->have_posts() ) { $string .= ''; return $string; /* Restore original Post Data */ wp_reset_postdata(); } // Add a shortcode add_shortcode('newsposts', 'news_postsbycategory'); function password_postsbycategory() { // the query $the_query = new WP_Query( array( 'category_name' => 'unlock screen, unlock lg password, unlock motorola password, unlock password samsung, unlock xiaomi password, unlock oneplus password, unlock oppo password, unlock nokia password', 'posts_per_page' => 8 ) ); // The Loop if ( $the_query->have_posts() ) { $string .= ''; return $string; /* Restore original Post Data */ wp_reset_postdata(); } // Add a shortcode add_shortcode('unlockpasswordposts', 'password_postsbycategory'); ?>